home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4513 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.2 KB

  1. Path: gate.bronson.com!usenet
  2. From: SWade@bronson.com (Scott Wade)
  3. Newsgroups: comp.lang.c++,comp.os.ms-windows.programmer.win32
  4. Subject: Re: MFC and console apps
  5. Date: Tue, 30 Jan 1996 16:57:20 GMT
  6. Organization: Bronson, Bronson and McKinnon
  7. Message-ID: <4eli9l$2r1@gate.bronson.com>
  8. References: <4ejfsi$h5s@gate.bronson.com> <4ek6jp$k3g@Venus.mcs.com>
  9. NNTP-Posting-Host: romulus.bronson.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. marcr@MCS.COM (Marc Rossi) wrote:
  13.  
  14. >: New to MFC and wondering whether it's possible to use MFC classes in a
  15. >: CONSOLE app?  
  16.  
  17. >I had the same question about a week ago, wanting to use the DAO classes
  18. >in MFC for a console app.  According to MS (at least according to the
  19. >MS support person I spoke with) it is possible to write a console app 
  20. >using MFC but it is not a recommended procedure.  Some of the MFC classes
  21. >make references to classes that would only have been instantiated if
  22. >you were running a Windowed app, such as a CWinApp object.  MS suggested
  23. >creating a dummy CWinApp instance if I really needed to use MFC.  I passed
  24. >on the suggestion (sounds like a kludge to me).  FYI, I was unable to use
  25. >DAO without having a MFC dependency (the DAO SDK on the VC CD has MFC
  26. >dependencies).
  27.  
  28. Thanks for the info....my main problem was the linkage errors
  29. generated when building an .exe from a console app that makes use
  30. of various MFC Classes (none of the instantiated only under a CWinApp
  31. instance classes).  Linkage wanted externals:
  32.  
  33.      _endthreadex        (from nafxcwd.lib) and
  34.     _beginthreadex        (from nafxcwd.lib)
  35.  
  36. coming from the inclusion of <afx.h>.  
  37.  
  38. Finally found the problem.....using a new console app project defaults
  39. to no MFC support.  By defining _AFXDLL (/D "_AFXDLL") the code was
  40. dynamically linked with the MFC DLL and proper linkage occured with no
  41. errors.
  42.  
  43. ---------------------------------------------------------------
  44.  __                               MIS Department
  45. (_  _  _ -+--+-  |  | _. _| _     Bronson, Bronson & McKinnon
  46. __)|_ |_| |  |   |/\|(_|(_|(/_    505 Montgomery Street
  47. ================================  San Francisco CA  94111-2514
  48.  "Our OS which art in CPU,        Phone: (415) 986-4200 
  49.      Unix be thy name..."         Fax:   (415) 982-1394
  50.  
  51. -----------------------< SWade@bronson.com >-------------------
  52.  
  53.